//
//  TMGEleSignViewController.m
//  TMGold
//
//  Created by Mac on 2017/12/8.
//  Copyright © 2017年 tangmu. All rights reserved.
//

#import "TMGFromViewController.h"
@interface TMGFromViewController ()

@end

@implementation TMGFromViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"金价来源";
    [self configSubView];
    // Do any additional setup after loading the view.
}
#pragma mark --subView
- (void)configSubView{
    UIView * header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 100)];
    header.backgroundColor = [UIColor whiteColor];
    
    STButton * buyButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth - 0, 44)
                                                     title:@"金价来源"
                                                titleColor:TM_orangeColor
                                                 titleFont:14
                                              cornerRadius:0
                                           backgroundColor:self.tableView.backgroundColor
                                           backgroundImage:nil
                                                     image:[UIImage imageNamed:@"金价来源"]];
    [header addSubview:buyButton];
    buyButton.imageEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0);
    buyButton.titleEdgeInsets = UIEdgeInsetsMake(0, 30, 0, 0);
    
    NSString * desStr = @"\n\n·为了方便您随时进行黄金交易，黄金口袋为您提供了7天*24小时不间断的金价报价。\n\n\n·上海黄金交易所时间段内，黄金口袋金价实时参照上海黄金交易所最新成交价。\n\n\n·上海黄金交易所休盘期间，黄金口袋金价参照上海黄金交易所最新成交价。\n\n\n·每周末全球黄金交易所闭盘时，黄金口袋金价参照本周国际金价收盘价，金价不发生波动\n\n";
    STLabel * desLable = [[STLabel alloc] initWithFrame:CGRectMake(15, buyButton.bottom , UIScreenWidth - 30, 200)
                                                   text:desStr
                                              textColor:TM_secendTextColor
                                                   font:14
                                            isSizetoFit:NO
                                          textAlignment:NSTextAlignmentLeft];
    [NSString lableAutoAdjustheightWithLabel:desLable];
    desLable.height = desLable.height;
    //    desLable.attributedText = [desLable.text st_convertAttributeStringWithKeyWords:@[@"·",@"·",@"·"] attributes:@[@{NSForegroundColorAttributeName:TM_orangeColor},@{NSForegroundColorAttributeName:TM_orangeColor},@{NSForegroundColorAttributeName:TM_orangeColor}]];
    [header addSubview:desLable];
    
    UIView * garwView = [[UIView alloc] initWithFrame:CGRectMake(0, desLable.bottom, UIScreenWidth, 10)];
    garwView.backgroundColor = self.tableView.backgroundColor;
    [header addSubview:garwView];
    
    __weak typeof(self) weakSelf =  self;
    STButton * applyButton = [[STButton alloc] initWithFrame:CGRectMake(15, garwView.bottom , UIScreenWidth - 30, 44)
                                                       title:@"查看上海黄金交易时间"
                                                  titleColor:TM_orangeColor
                                                   titleFont:15
                                                cornerRadius:0
                                             backgroundColor:[UIColor whiteColor]
                                             backgroundImage:nil
                                                       image:nil];
    [applyButton setClicAction:^(UIButton *sender) {
        [weakSelf onSelectedTimeButton];
    }];

    [header addSubview:applyButton];
    
    header.height = applyButton.bottom ;
    self.tableView.tableHeaderView = header;
}
#pragma mark --Action Method
- (void)onSelectedTimeButton{
    
    TMGNotePresentViewController * noteVC = [TMGNotePresentViewController new];
    noteVC.note = @"上海交易所交易时间:每周一9点至周六14点半，周五下午两点半发每周的最后一期，周天休市";
    noteVC.titleString = @"小提示";
    [self presentViewController:noteVC animated:NO completion:nil];
    
    //[SVProgressHUD showInfoWithStatus:@"上海交易所交易时间:每周一9点至周六14点半，周五下午两点半发每周的最后一期，周天休市"];
}

@end

